package cn.wanda.bi.sunshine.platform.server.client.wrapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cn.wanda.bi.sunshine.platform.server.client.FFanLiveClient;
import cn.wanda.bi.sunshine.platform.server.client.request.AuthRequest;
import cn.wanda.bi.sunshine.platform.server.controller.response.common.SimpleResponse;
import cn.wanda.bi.sunshine.platform.server.utils.JsonUtil;
import cn.wanda.bi.sunshine.platform.server.utils.exception.ClientException;


/**
 * Created by wangfupeng1
 */
@Component
public class FFanLiveClientWrapper {

    @Autowired
    private FFanLiveClient fFanLiveClient;

    /**
     * 万信登录校验
     */
    public SimpleResponse liveV1Signature(AuthRequest authRequest) {
        SimpleResponse response =
                JsonUtil.toObject(fFanLiveClient.liveV1Signature(authRequest),SimpleResponse.class);
        if (response.getStatus() != 200)
            throw new ClientException(response.getStatus(), response.getMessage());
        return response;
    }

}
